Uploading Credentials with the Java Library
Depending on the workflow that will be executed you can:
-
Use the
performUploadIds()
step method to upload credential files from your server. -
Use the
performUploadPreparedData()
step method to upload raw data values.
Uploading files requires that you obtain user consent. See End-User Consent to Collect Personal Data for additional information.
Example Using performUploadIds()
@GetMapping(path = "/upload", produces = MediaType.TEXT_HTML_VALUE) public String htmlUploadForm() { return """ <form action="./upload" method="post" enctype="multipart/form-data"> <fieldset> <legend>Upload ID</legend> <input type="file" name="file"> <input type="checkbox" name="consent" value="yes" /> <input type="submit"value="Upload and verify"> </fieldset> </form> """; } @PostMapping("/upload") public String createAPINewWorkflow( @RequestParam("file") MultipartFile file, @RequestParam("consent") String consent) throws IOException { if (!"yes".equalsIgnoreCase(consent)) { throw new IllegalStateException("User did not consent!"); } final UUID reference = UUID.randomUUID(); final OffsetDateTime dateTimeNow = OffsetDateTime.now(); UserConsent userConsent = new UserConsent() .userIp("46.139.143.174") .userLocation(new UserLocation() .country(CountryCodeISO3166alpha3.USA.toString()) .state("IL") ) .consent(new Consent() .obtained("yes") .obtainedAt(dateTimeNow) ); final IdUploadResponse finish = jumioClient.initiateNewAccount(FluentBuilderWorkflows.STANDALONE_ID_VERIFICATION_10015) .customerInternalReference(reference.toString()) .callbackUrl(CALLBACK_URL) .withDefaultCredentials() .performUploadIds() .userConsent(userConsent) .uploadFront(file.getInputStream()) .skipBackUpload() .finish(); return "Done with wfid: " + finish.getAccountResponse().getWorkflowExecution().getId(); }
Example Using performUploadPreparedData()
This example assumes you have a simple data transfer class called EndUserForm, with fields corresponding to the required prepared data values.
@PostMapping(value = "/verifyDL", consumes = {MediaType.APPLICATION_JSON_VALUE}) public String verifyDL(@RequestBody EndUserForm endUserForm) { JumioClient jumioClient = applicationContext.getBean(JumioClient.class); final PreparedDataResponse response = jumioClient .initiateNewAccount(FluentBuilderWorkflows.Standalone_DL_Verification_USA_10008) .customerInternalReference("mycompany") .callbackUrl(null) .withDefaultCredentials() .performUploadPreparedData() .userConsent(new UserConsent() .userLocation( new UserLocation() .country(CountryCodeISO3166alpha3.USA.toString()) .state("CA") ) .userIp("46.139.143.174") .consent( new Consent() .obtained("yes") .obtainedAt(OffsetDateTime.now()) )) .addPreparedData(new PreparedData() .address(new Address() .city(endUserForm.getAddress().getCity()) .country(endUserForm.getAddress().getCountry()) .line1(endUserForm.getAddress().getLine1()) .line2(endUserForm.getAddress().getLine2()) .subdivision(endUserForm.getAddress().getSubdivision()) .postalCode(endUserForm.getAddress().getPostalCode())) .firstName(endUserForm.getFirstName()) .lastName(endUserForm.getLastName()) .dateOfBirth(LocalDate.parse(endUserForm.getDob())) .socialSecurityNumber(endUserForm.getSsn()) .id(new IdDetails() .idNumber(endUserForm.getIdNumber()) .type("DRIVING_LICENSE") .issuingDate(LocalDate.of(2019, 12, 26)) .expiryDate(LocalDate.of(2025, 1, 18)))) .finish(); return response.toString(); }